﻿using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

using zijian666.Core.Abstractions;

namespace zijian666.DI.Features;

/// <summary>
/// 配置服务过滤器
/// </summary>
public interface IConfigureServicesFilter : IFeature
{
    /// <summary>
    /// <seealso cref="ConfigureServicesExtensions.AddComponents(IServiceCollection)"/> 前触发
    /// </summary>
    void BeginAddComponents(IServiceCollection services) { }
    /// <summary>
    /// <seealso cref="ConfigureServicesExtensions.AddComponents(IServiceCollection)"/> 后触发
    /// </summary>
    void EndAddComponents(IServiceCollection services) { }

    /// <summary>
    /// <seealso cref="ConfigureServicesExtensions.ConfigureServices(IServiceCollection, object, object[])"/> 前触发
    /// </summary>
    void BeginConfigureServices(IServiceCollection services, Type configureType, object[] param) { }

    /// <summary>
    /// <seealso cref="ConfigureServicesExtensions.ConfigureServices(IServiceCollection, object, object[])"/> 后触发
    /// </summary>
    void EndConfigureServices(IServiceCollection services, Type configureType, object[] param) { }

    /// <summary>
    /// <seealso cref="ConfigureServicesExtensions.Configure(IServiceProvider, object[])"/> 前触发
    /// </summary>
    void BeginConfigure(IServiceProvider serviceProvider, Type configureType, object[] args) { }

    /// <summary>
    /// <seealso cref="ConfigureServicesExtensions.Configure(IServiceProvider, object[])"/> 后触发
    /// </summary>
    void EndConfigure(IServiceProvider serviceProvider, Type configureType, object[] args) { }

    /// <summary>
    /// <seealso cref="ConfigureServicesExtensions.AddStartup(IHostBuilder, Type, object?)"/> 前触发
    /// </summary>
    void BeginAddStartup(IHostBuilder? hostBuilder, Type startupType) { }

    /// <summary>
    /// <seealso cref="ConfigureServicesExtensions.AddStartup(IHostBuilder, Type, object?)"/> 后触发
    /// </summary>
    void EndAddStartup(IHostBuilder? hostBuilder, Type startupType) { }

}
